import {
  q as a,
  p as be,
  ap as _e,
  X as z,
  f as xe,
  H as We,
  av as $,
  aw as Be,
  k as t,
  m as l,
  l as n,
  az as Ee,
  as as c,
  at as N
} from "./index-b50e6ef9.js";
import { v as Fe, a as j } from "./vip-d2446e08.js";
function Ce(X) {
  const b = a([]),
    M = a([]),
    Y = a({}),
    f = a(!0);
  a({});
  const O = a(),
    P = a();
  be();
  const p = a(1),
    h = a(10),
    m = a(1),
    _ = a(10),
    x = a(),
    W = a(""),
    B = a(""),
    E = a(""),
    F = a(""),
    G = a(""),
    D = a(""),
    w = a(""),
    I = a(""),
    C = a(""),
    S = a(""),
    A = a(""),
    T = a([]),
    V = a("");
  a();
  const U = a(),
    K = _e("reload"),
    k = z({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    v = z({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [5, 10, 20],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    Q = z({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    Z = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 50,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      {
        label: "ID",
        prop: "user_id",
        minWidth: 60,
        formatter: ({ user_id: e }) => `1${e}`
      },
      {
        label: "用户",
        prop: "user_name",
        minWidth: 130,
        formatter: ({ user_name: e, user_phone: i }) =>
          t("div", null, [t("div", null, [e]), t("div", null, [i])])
      },
      { label: "余额", prop: "user_money", minWidth: 120 },
      {
        label: "推荐关系",
        prop: "suggest_name",
        minWidth: 280,
        formatter: ({
          suggest_name: e,
          suggest_phone: i,
          store_fu: r,
          node_phone: d,
          node_name: u,
          store_shou: o,
          plan_phone: s
        }) =>
          t("div", null, [
            e ? t("div", null, [l("推荐人 "), e + ":" + i]) : "",
            s ? t("div", null, [l("绑定手机号: "), s]) : "",
            u ? t("div", null, [l("所属节点 "), u + ":" + d]) : "",
            t("div", null, [
              o
                ? t(
                    n("el-tag"),
                    { class: "mx-1", type: "success", effect: "light" },
                    { default: () => [l("首单:"), o, l("单")] }
                  )
                : "",
              r
                ? t(
                    n("el-tag"),
                    { class: "mx-1", type: "success", effect: "light" },
                    { default: () => [l("复购:"), r, l("单")] }
                  )
                : ""
            ])
          ])
      },
      { label: "注册时间", minWidth: 180, prop: "create_time" },
      {
        label: "冻结",
        minWidth: 80,
        prop: "user_status",
        formatter: ({ user_status: e }) =>
          e == 1
            ? t(
                n("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => [l("正常")] }
              )
            : t(
                n("el-tag"),
                { class: "mx-1", type: "danger", effect: "light" },
                { default: () => [l("已冻结")] }
              )
      },
      { label: "操作", fixed: "right", width: 230, slot: "operation" }
    ],
    ee = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "user_id", minWidth: 100 },
      { label: "用户", prop: "user_name", minWidth: 150 },
      { label: "手机号", prop: "user_phone", minWidth: 150 },
      { label: "等级", prop: "user_vip", minWidth: 200 },
      { label: "身份", prop: "user_place", minWidth: 200 },
      { label: "当前点位", prop: "user_divvy", minWidth: 200 },
      { label: "档位", prop: "user_position", minWidth: 200 },
      { label: "代理", prop: "city_name", minWidth: 150 },
      { label: "团长", prop: "user_group", minWidth: 200 },
      { label: "战区总裁", prop: "user_war", minWidth: 200 },
      { label: "积分", prop: "user_money", minWidth: 150 },
      { label: "收益", prop: "user_income", minWidth: 150 },
      { label: "云值", prop: "user_value", minWidth: 150 },
      { label: "总收益", prop: "all_income", minWidth: 150 },
      { label: "总云值", prop: "all_value", minWidth: 150 },
      { label: "团队业绩", prop: "team_income", minWidth: 150 },
      { label: "推荐人", prop: "suggest_name", minWidth: 200 },
      { label: "推荐人手机号", prop: "suggest_phone", minWidth: 200 },
      { label: "注册时间", minWidth: 180, prop: "create_time" }
    ],
    te = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "user_id", minWidth: 50 },
      { label: "用户", prop: "user_name", minWidth: 80 },
      { label: "手机号", prop: "user_phone", minWidth: 150 },
      { label: "团队业绩", prop: "team_income", minWidth: 100 },
      {
        label: "等级",
        prop: "user_vip",
        minWidth: 80,
        formatter: ({ user_vip: e }) => {
          if (e == 1)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("VIP")] }
            );
          if (e == 0)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "info", effect: "light" },
              { default: () => [l("会员")] }
            );
        }
      },
      {
        label: "身份",
        prop: "user_place",
        minWidth: 80,
        formatter: ({ user_place: e }) => {
          if (e == 0)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("暂无")] }
            );
          if (e == 1)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("一星合伙人")] }
            );
          if (e == 2)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("二星合伙人")] }
            );
          if (e == 3)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("三星合伙人")] }
            );
          if (e == 4)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("四星合伙人")] }
            );
          if (e == 5)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("五星合伙人")] }
            );
          if (e == 6)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("一星联创")] }
            );
          if (e == 7)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("二星联创")] }
            );
          if (e == 8)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("三星联创")] }
            );
          if (e == 9)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("四星联创")] }
            );
          if (e == 10)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("一星董事")] }
            );
          if (e == 11)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("二星董事")] }
            );
          if (e == 12)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [l("三星董事")] }
            );
        }
      },
      {
        label: "团长",
        prop: "user_group",
        minWidth: 80,
        formatter: ({ user_group: e }) =>
          e == 1
            ? t(
                n("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => [l("团长")] }
              )
            : t(
                n("el-tag"),
                { class: "mx-1", type: "info", effect: "light" },
                { default: () => [l("暂无")] }
              )
      },
      { label: "余额", prop: "user_money", minWidth: 100 },
      { label: "收益", prop: "user_income", minWidth: 100 },
      { label: "云值", prop: "user_value", minWidth: 100 },
      { label: "创建时间", prop: "create_time", minWidth: 120 }
    ],
    ae = xe(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function le(e) {
    Ee(e);
  }
  async function ne(e) {
    const i = { id: e.id },
      r = JSON.stringify(i),
      u = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(r)) },
      o = await questionDelete(u);
    o.code == 200
      ? (N("删除成功", { type: "success" }), K())
      : N(o.msg, { type: "error" });
  }
  function ue() {}
  function se(e) {
    (h.value = e), L(void 0, e);
  }
  function ie(e) {
    (p.value = e), L(e, void 0);
  }
  function re(e) {}
  function oe(e) {
    (_.value = e), J(void 0, 1, V.value, U.value);
  }
  function de(e) {
    (m.value = e), J(void 0, 1, V.value, U.value);
  }
  function ce(e) {}
  function fe(e) {
    (Q.text = `正在加载第${e}页...`),
      (f.value = !0),
      $(600).then(() => {
        f.value = !1;
      });
  }
  async function J(e = void 0, i, r, d = void 0, u = void 0) {
    i == 1 && (p.value = 1),
      (V.value = r),
      (x.value = e || x.value),
      (U.value = d),
      (m.value = u || m.value);
    const o = {
        page: u || m.value,
        pagesize: _.value,
        user_id: x.value,
        action: d || "all",
        vip_place: r
      },
      s = JSON.stringify(o),
      y = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(s)) },
      g = await Fe(y);
    g.code == 200 &&
      (u && ((v.currentPage = u), (v.pageSize = 10)),
      (M.value = g.data.data),
      (v.total = g.data.total));
  }
  async function pe(e, i, r, d, u, o, s, R, y, g, q) {
    (W.value = e || void 0),
      (B.value = i || void 0),
      (E.value = r || void 0),
      (F.value = d || void 0),
      (D.value = u || void 0),
      (w.value = o || void 0),
      (I.value = s || void 0),
      (A.value = R || void 0),
      (C.value = y || void 0),
      (G.value = g || void 0),
      (S.value = q || void 0),
      (f.value = !0);
    const he = {
        page: p.value,
        pagesize: h.value,
        name_phone: e,
        user_vip: i,
        user_place: r,
        user_group: d,
        sort: u,
        city_type: o,
        user_send: s,
        place_status: R,
        vip_place: q,
        user_war: y
      },
      ve = JSON.stringify(he),
      ye = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(ve)) },
      { data: H } = await j(ye);
    (b.value = H.data),
      (k.total = H.total),
      setTimeout(() => {
        f.value = !1;
      }, 500);
  }
  async function L(e = p.value, i = h.value) {
    const r = {
        page: e,
        pagesize: i,
        name_phone: W.value == "" ? void 0 : W.value,
        user_vip: B.value == "" ? void 0 : B.value,
        user_place: E.value == "" ? void 0 : E.value,
        user_group: F.value == "" ? void 0 : F.value,
        sort: D.value == "" ? void 0 : D.value,
        user_send: I.value == "" ? void 0 : I.value,
        place_status: A.value == "" ? void 0 : A.value,
        city_type: w.value == "" ? void 0 : w.value,
        user_war: C.value == "" ? void 0 : C.value,
        vip_place: S.value == "" ? void 0 : S.value,
        start: T.value[0],
        end: T.value[1]
      },
      d = JSON.stringify(r),
      o = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(d)) },
      s = await j(o);
    s.code === 200
      ? ((O.value = s.data.money_count),
        (P.value = s.data.income_count),
        (b.value = s.data.data),
        (k.total = s.data.total),
        setTimeout(() => {
          f.value = !1;
        }, 500))
      : N(s.msg, { type: "error" });
  }
  function me({ row: e }) {
    return e.user_status == 1 ? "" : { background: "#FFE8E7" };
  }
  const ge = e => {
    e && (e.resetFields(), location.reload());
  };
  return (
    We(() => {
      $().then(() => {
        const { setWatermark: e } = Be(X.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        L();
    }),
    {
      loading: f,
      columns: Z,
      dataList: b,
      userColumns: te,
      pagination: k,
      paginationDio: v,
      buttonClass: ae,
      userDatilList: M,
      orderInfo: Y,
      columnsExcel: ee,
      userMoney: O,
      userIncom: P,
      count: p,
      pageCount: h,
      countUser: m,
      pageCountUser: _,
      handleLookUserDatil: J,
      onSearch: pe,
      resetForm: ge,
      handleaddUser: ue,
      handleUpdate: le,
      handleDelete: ne,
      handleSizeChange: se,
      handleCurrentChange: ie,
      handleSelectionChange: re,
      handleSizeChangeDio: oe,
      handleCurrentChangeDio: de,
      handleSelectionChangeDio: ce,
      onCurrentChange: fe,
      cellStyle: me
    }
  );
}
export { Ce as useRole };
